package com.kede.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.kede.entity.Release;
import com.kede.dao.ReleaseDao;
import com.kede.service.ReleaseService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 【请填写作者】
 * @since 2020-04-02
 */
@Service
public class ReleaseServiceImpl extends ServiceImpl<ReleaseDao, Release> implements ReleaseService {
    @Autowired
    ReleaseDao releaseDao;

    @Override
    public Release getByMid(long mid) {
        QueryWrapper<Release> Wrapper = new QueryWrapper<Release>();
        Wrapper.eq("mid",mid);
        Release one = releaseDao.selectOne(Wrapper);
        return one;
    }

    @Override
    public boolean updatebp(Release release) {
        if (releaseDao.updateById(release)>0){
            return true;
        }
        return false;
    }

    @Override
    public List<Release> releaseSreachByTitle(String title,Integer page,Integer limit) {
        return releaseDao.releaseSreachByTitle(title,page,limit);
    }

    @Override
    public Integer countByTitle(String title) {
        return releaseDao.countByTitle(title);
    }

    @Override
    public int deleteReleaseById(Integer id) {
        return releaseDao.deleteReleaseById(id);
    }

}
